package com.yunqiao.common.utils;

import lombok.Data;

/**
 * @program: server
 * @description:
 * @author: Crocutax
 * @company: 今日速运
 * @e-mail: wangxw725@163.com
 * @create: 2019-03-03 00:27
 **/
@Data
public class ResponseUtil<T> {

    private int code;

    private String msg;

    private T data;

    public ResponseUtil() {
        this.code = 0;
        this.msg = "success";
    }

    public static ResponseUtil ok() {
        return new ResponseUtil();
    }

    public ResponseUtil objectOk(T t) {
        ResponseUtil responseUtil = new ResponseUtil();
        responseUtil.setData(t);
        return responseUtil ;
    }

//    public static ResponseUtil ok(String msg) {
//        ResponseUtil responseUtil = new ResponseUtil();
//        responseUtil.setMsg(msg);
//        return responseUtil;
//    }
//
//
    public static ResponseUtil ok(String msg) {
        ResponseUtil responseUtil = new ResponseUtil();
        responseUtil.setMsg(msg);
        return responseUtil;
    }

}
